from rest_framework import serializers
from ..models import DocumentVersion
from .document import UserSerializer

class DocumentVersionSerializer(serializers.ModelSerializer):
    """文档版本序列化器"""
    created_by = UserSerializer(read_only=True)

    class Meta:
        model = DocumentVersion
        fields = ['id', 'document', 'content', 'version', 'comment', 
                 'created_by', 'created_at']
        read_only_fields = ['created_at'] 